const { v4 } = require('uuid');

const TaskStatus = require('./taskStatus');
const FileInfo = require('./fileInfo');

/*
 * @Description: 任务
 */
class Task {
    constructor() {
        this.id = v4();
        this.event = null;
        this.status = TaskStatus.WAIT;
        this.createTime = Date.now();
        this.endTime = Date.now();
        this.percentage = 0;
        this.pos = 0;
    }

    SetUrl(url) {
        this.url = url;
    }

    GetUrl() {
        return this.url;
    }

    SetID(id) {
        this.id = id;
    }

    GetID() {
        return this.id;
    }

    SetStatus(status) {
        this.status = status;
    }

    GetStatus() {
        return this.status;
    }

    SetPercentage(percentage) {
        this.percentage = percentage;
    }

    GetPercentage() {
        return this.percentage;
    }

    GetParentTaskID() {}

    SetLocalPath(localPath) {
        this.localPath = localPath;
    }

    GetLocalPath() {
        return this.localPath;
    }

    GetCreateTime() {
        return this.createTime;
    }

    SetEndTime(endTime) {
        this.endTime = endTime;
    }

    GetEndTime() {
        return this.endTime;
    }

    GetFileInfo() {
        return this.fileInfo;
    }

    SetFileInfo(fileInfo) {
        this.fileInfo = fileInfo;
    }

    SetPos(pos) {
        this.pos = pos;
    }

    GetPos() {
        return this.pos;
    }

    SubscribeEvent(event) {
        this.event = event;
    }

    SetExtraData(event) {
        this.extraData = event;
    }

    GetExtraData() {
        return this.extraData;
    }

    SetPjId(id) {
        this.pjId = id;
    }

    GetPjId() {
        return this.pjId;
    }
    SetBusId(id) {
        this.busId = id;
    }
    GetBusId() {
        return this.busId;
    }

    SetCoId(id) {
        this.coId = id;
    }
    GetCoId() {
        return this.coId;
    }
    SetPjName(name) {
        this.pjName = name;
    }
    GetPjName() {
        return this.pjName;
    }
}

module.exports = Task;
